package com.hutu.erp.catalog.dto;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.dto.BaseDto;

import java.util.ArrayList;
import java.util.List;

/**
 * Description: com.hutu.erp.catalog.dto
 * User: hushibo
 * Date: 2021-06-01 16:01
 * Time: 16:01
 * Version: 1.0
 */
public class CategoryOutput extends BaseDto {

    /** 商品分类id */
    private Long categoryId;

    /** 父级分类id */
    @Excel(name = "父级分类id")
    private Long parentId;

    /** 名称 */
    @Excel(name = "名称")
    private String categoryName;

    /** 简称 */
    @Excel(name = "简称")
    private String alternativeName;

    /** 编码 */
    @Excel(name = "编码")
    private String categoryCode;

    /** 查询码 */
    @Excel(name = "查询码")
    private String lookup;

    /** 显示顺序 */
    @Excel(name = "显示顺序")
    private Long displayOrder;

    private String ancestors;

    private boolean leaf;
    private int level;
    private boolean hasChildren;

    public boolean isLeaf() {
        return leaf;
    }

    public void setLeaf(boolean leaf) {
        this.leaf = leaf;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public boolean isHasChildren() {
        return hasChildren;
    }

    public void setHasChildren(boolean hasChildren) {
        this.hasChildren = hasChildren;
    }

    /** 子节点 */
    private List<CategoryOutput> children;


    public void setAncestors(String ancestors)
    {
        this.ancestors = ancestors;
    }

    public String getAncestors()
    {
        return ancestors;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getAlternativeName() {
        return alternativeName;
    }

    public void setAlternativeName(String alternativeName) {
        this.alternativeName = alternativeName;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    public String getLookup() {
        return lookup;
    }

    public void setLookup(String lookup) {
        this.lookup = lookup;
    }

    public Long getDisplayOrder() {
        return displayOrder;
    }

    public void setDisplayOrder(Long displayOrder) {
        this.displayOrder = displayOrder;
    }

    public List<CategoryOutput> getChildren() {
//        if(children == null){
//            children = new ArrayList<CategoryOutput>();
//        }
        return children;
    }

    public void setChildren(List<CategoryOutput> children) {
        //
        this.children = children;
    }


    @Override
    public String toString() {
        return "CategoryOutput{" +
                "categoryId=" + categoryId +
                ", parentId=" + parentId +
                ", categoryName='" + categoryName + '\'' +
                ", alternativeName='" + alternativeName + '\'' +
                ", categoryCode='" + categoryCode + '\'' +
                ", lookup='" + lookup + '\'' +
                ", displayOrder=" + displayOrder +
                // ", children=" + children +
                '}';
    }

    public CategoryOutput() {
    }

    public CategoryOutput(Long categoryId, Long parentId, String categoryName,
                          String alternativeName, String categoryCode, String lookup, Long displayOrder) {
        this.categoryId = categoryId;
        this.parentId = parentId;
        this.categoryName = categoryName;
        this.alternativeName = alternativeName;
        this.categoryCode = categoryCode;
        this.lookup = lookup;
        this.displayOrder = displayOrder;
        // this.ancestors = ancestors;
    }
}
